package com.freshmarket.freshmarket.controller;


import com.freshmarket.freshmarket.entity.Pages;
import com.freshmarket.freshmarket.service.IUserService;
import com.freshmarket.freshmarket.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Calendar;
import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Squirrel
 * @since 2020-09-04
 */
@RestController
@RequestMapping("/freshmarket/user")
@Slf4j
public class UserController {
    @Autowired
    private IUserService iUserService;
    //条件分页查询用户
    @RequestMapping("showPage")
    public Result showPage(@RequestParam(defaultValue = "1")int pageIndex,
                           @RequestParam(defaultValue = "3")int pageSize, String userName,String userPhone)throws Exception {
        log.info("当前页码:{}"+pageIndex,"每页显示条数：{}"+pageSize,"用户名:{}"+userName,"电话:{}"+userPhone);
        Pages pages = iUserService.selectNowPageAll(pageIndex, pageSize, userName, userPhone);
        System.out.println(pages.toString());
        return pages;
    }

}

